cmake_minimum_required(VERSION 2.8)
project(tcp_server)
add_compile_options(-std=c++0x)
#add_definitions(-Wall -g)# -Wl,-rpath=${CMAKE_INSTALL_PREFIX}/lib)

set(CMAKE_MACOSX_RPATH 0)

# Add source files to project and define ${SRC}
aux_source_directory(. SRC)

# This program depend on wzutil, the include file is in following line.
# The wzutil project is in the same git repository.
include_directories(. ../../util/WZTKUtil/include)

# wzutil is here.
link_directories("/usr/local/lib")

# Define target "ssrv", and this target is build from "{SRC}"
# Note: Command "link_directories" must be front. Otherwise report error: "libwzutil.so: cannot open shared object file: No such file or directory" while running.
add_executable(tcp_server ${SRC})

# The target "tcp_server" depends on libraries: pthread,rt and wzutil.
# Note the "wzutil" libarary must be installed to a default libarary folder like "/usr/lib" or "/usr/local/lib".
target_link_libraries(tcp_server pthread rt wzutil)

# The binary files will be put to here when the targets builded.
set(EXECUTABLE_OUTPUT_PATH ./bin)

#add_definitions(-DENABLE_FLOW_RECORD -DTEST_RECORD_DNS_ENABLE -DENABLE_COMM_BAN)

# The "make install" setting for target "tcp_server".
install(TARGETS tcp_server
        RUNTIME DESTINATION tcp_server
)

